package com.xhwl.data.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Attr;
import com.xhwl.common.query.cent.sdata.AttrQuery;
import com.xhwl.data.service.IAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: zhangliuli
 * @Description:
 * @Date: Create in &{date} &{time}
 */
@RestController
public class AttrController {
    @Autowired
    IAttrService attrService;
    /**
     * 企业配置新增
     */
    @PostMapping("/attr/create")
    public ResultJson create(@RequestBody Attr attr) {
        return attrService.create(attr);
    }
    /**
     * 企业配置修改
     */
    @PostMapping("/attr/update")
    public ResultJson update(@RequestBody Attr attr) {
        return attrService.update(attr);
    }
    /**
     * 企业配置删除
     */
    @GetMapping("/attr/delete")
    public ResultJson delete(Integer id) {
        return attrService.delete(id);
    }
    /**
     * 企业配置列表查询
     */
    @GetMapping("/attr/list")
    public ResultJson list(AttrQuery attrQuery) {
        List<Attr> list = attrService.list(attrQuery);
        return ResultJson.success(list);
    }
    /*
     * 企业配置列表查询
     */
    @GetMapping("/attr/page")
    public ResultJson page(Page page, AttrQuery attrQuery) {
        Page<Attr> page1 = attrService.page(page, attrQuery);
        return ResultJson.success(page1);
    }

}
